Encoding:

P32A

001000

rt

rs

rd

SUBU.QB

0

1011001

101

P32A

001000

rt

rs

rd

SUBU.QB

1

1011001

101

6

5

5

5

1

7

3

Format:

SUBU[_S].QB 

Subtract Unsigned Quad Byte Vector

SUBU.QB   rd, rs, rt

DSP

Subtract Unsigned Quad Byte Vector

SUBU_S.QB rd, rs, rt

DSP

Subtract Unsigned Quad Byte Vector

Purpose:

Subtract Unsigned Quad Byte Vector

Element-wise subtraction of one vector of unsigned byte values from another to produce a vector of unsigned byte results, with optional saturation.

Description:

rd = sat8(rs31..24 - rt31..24) || sat8(rs23..16 - rt23..16) || sat8(rs15..8 - 
rt15..8) || sat8(rs7..0 - rt7..0)

The four byte elements in rt are subtracted from the corresponding byte elements in register rs.

For the non-saturating version of the instruction, the result modulo 256 is written into the corresponding position in register rd.

For the saturating version of the instruction the subtraction is performed using unsigned saturating arithmetic. If the subtraction results in underflow, the value is clamped to the smallest representable value (0 decimal, 0x00 hexadecimal) before being written to the destination register rd.

For each instruction, if any of the individual subtractions result in underflow or saturation, a 1 is written to bit 20 in the DSPControl register within the ouflag field.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

SUBU.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = subtractU8( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = subtractU8( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = subtractU8( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = subtractU8( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
SUBU_S.QB:
   ValidateAccessToDSPResources()
   tempD7..0 = satU8Subtract( GPR[rs]31..24 , GPR[rt]31..24 )
   tempC7..0 = satU8Subtract( GPR[rs]23..16 , GPR[rt]23..16 )
   tempB7..0 = satU8Subtract( GPR[rs]15..8 , GPR[rt]15..8 )
   tempA7..0 = satU8Subtract( GPR[rs]7..0 , GPR[rt]7..0 )
   GPR[rd]31..0 = tempD7..0 || tempC7..0 || tempB7..0 || tempA7..0
   if ( temp8 = 1 ) then
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction subtractU8
function satU8Subtract( a7..0, b7..0 )
   temp8..0 = ( 0 || a7..0 ) - ( 0 || b7..0 )
   if ( temp8 = 1 ) then
      temp7..0 = 0x00
      DSPControlouflag:20 = 1
   endif
   return temp7..0
endfunction satU8Subtract

Exceptions:

Reserved Instruction, DSP Disabled